/*****************************************************************************/
/*                           Liberty                                         */
/*****************************************************************************/
/* Stored Procedure :: AllStates											 */
/* Reads All States from States table.										 */
/*****************************************************************************/
/* Copyright (C) 2007, Perot Systems Corporation. All right reserved.        */
/* Developer: Nara Alzapur(narasimha.v@ps.net)                               */
/* Started:  10/17/2007                                                      */
/*****************************************************************************/
/* Modifications                                                             */
/* Date       |  Author          | Description                               */
/*------------+------------------+-------------------------------------------*/
/*****************************************************************************/

/******************************************************************************/
/* Step 0. Preparations/Declarations                                          */
/******************************************************************************/
SET NOCOUNT OFF

/******************************************************************************/
/* Step 1. Remove stored procedure if it already exists                       */
/******************************************************************************/
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.ROUTINES 
			WHERE SPECIFIC_SCHEMA = N'dbo'
			AND SPECIFIC_NAME = N'AllStates' 
			)
BEGIN
	DROP PROCEDURE dbo.AllStates
END
GO

/*****************************************************************************/
/* Stored Procedure :: AllStates                        */
/*****************************************************************************/
CREATE PROCEDURE dbo.AllStates
AS  
BEGIN
SELECT	
	OID,
	Version,
	Description,
	Active,
	DisplayOrder
FROM
	States (nolock)
ORDER BY DisplayOrder

END
GO

/******************************************************************************/
/* Step 3. Assign appropriate permissions                                     */
/******************************************************************************/
GRANT EXECUTE ON dbo.AllStates TO Liberty_Users
GO
-- Developers and Admins have permissions to execute through membership